# homework：
# 1. 尝试用户输入学生一周的课表信息，尝试用 占位符、2种format打印学生信息（可设计）
# 2. 用户输入查询日期和时间，可返回对应的课表信息；用户查询当前时间，可返回当前课表信息
# 3. Python内置数据结构 列表 切片、方法练习
# 4. 完成课本练习
#
# 思考题：
# names = [.....]
# 想找出重名的名字 ------> rename = [..]？
#
# 循环遍历每一个元素---->[]
# 如果遍历到某一个前面出现过，存到一个[]
# 计算重名个数？ '''
#
# 「列表训练营」
# 1. 输入一行字符，分别统计出其中英文字母、空格、数字和其它字符的个数。
# 2. 班上投票竞选，将选择票数最高的同学担任班长，请你设计一个投票系统，输入名字即可投票，最后统计大家的得票数，公开投票结果，并宣布谁担任班长。

# 1.用户输入学生一周的课表信息
# （1）占位符

name = input("姓名:")
week = input("星期:")
first_class = input("1-2节（8：00~9：30）:")
second_class = input("3-5节（9：45~12：00）:")
third_class = input("6-7节（12：50~14：20）:")
forth_class = input("8-9节（14：30~15：55）:")
fifth_class = input("10-11节（16：10~17：35）:")
sixth_class = input("12-13节（18：45~20：10）:")
seventh_class = input("14-15节（20：15~21：45）:")
greeting = input("每日宣言：")

info01 = '''
--------------------------%s的今日课程表-----------------------------
                            |星期%s|
-------------------------------------------------------------------
          |1-2节（8：00~9：30）:%s|
          |3-5节（9：45~12：00）:%s|
          |6-7节（12：50~14：20）:%s|
          |8-9节（14：30~15：55）:%s|
          |10-11节（16：10~17：35）:%s|
          |12-13节（18：45~20：10）:%s|
          |14-15节（20：15~21：45）:%s|
-------------------------------------------------------------------
|每日宣言：%s|
-------------------------------------------------------------------

''' % (name,week,first_class,second_class,third_class,forth_class,fifth_class,sixth_class,seventh_class,greeting)

print(info01)

#（2）第一种format

info02 = '''
--------------------------{姓名}的今日课程表-----------------------------
                            |星期{星期}|
-------------------------------------------------------------------
          |1-2节（8：00~9：30）:{第1节}|
          |3-5节（9：45~12：00）:{第2节}|
          |6-7节（12：50~14：20）:{第3节}|
          |8-9节（14：30~15：55）:{第4节}|
          |10-11节（16：10~17：35）:{第5节}|
          |12-13节（18：45~20：10）:{第6节}|
          |14-15节（20：15~21：45）:{第7节}|
-------------------------------------------------------------------
|每日宣言：{宣言}|
-------------------------------------------------------------------
'''.format(姓名=name,星期=week,第1节=first_class,第2节=second_class,第3节=third_class,第4节=forth_class,第5节=fifth_class,第6节=sixth_class,第7节=seventh_class,宣言=greeting)

print(info02)

#（2）第2种format

info03 = '''
--------------------------{0}的今日课程表-----------------------------
                            |星期{1}|
-------------------------------------------------------------------
          |1-2节（8：00~9：30）:{2}|
          |3-5节（9：45~12：00）:{3}|
          |6-7节（12：50~14：20）:{4}|
          |8-9节（14：30~15：55）:{5}|
          |10-11节（16：10~17：35）:{6}|
          |12-13节（18：45~20：10）:{7}|
          |14-15节（20：15~21：45）:{8}|
-------------------------------------------------------------------
|每日宣言：{9}|
-------------------------------------------------------------------
'''.format(name,week,first_class,second_class,third_class,forth_class,fifth_class,sixth_class,seventh_class,greeting)

print(info03)

#2.用户输入查询日期和时间，可返回对应的课表信息；用户查询当前时间，可返回当前课表信息

import datetime
import time
d = datetime.date.today()
week_day = time.strftime("%A")

name = input("姓名:")
week = input("星期:")
now = input("时间:")#查询的时间
judge_day = input("是否查询今日的课表信息：")
judge_current = input("是否查询当前时间的课表信息：")
time_now = time.strftime("%H:%M")#当前时间


info04 = '''
-----------{姓名}的今日课程表------------
'''.format(姓名=name)

print(info04)

if week in "一":
    print("今日课表")
    print("今日无课")
elif week in "二":
    print("今日课表")
    print("[12:50~14:20]Illustrato软件应用")
    print("[14:30~15:55]体育—足球课")
    print("[18:45~20:55]设计美学")
elif week in "三":
    print("今日课表")
    print("[08:00~09:30]毛概实践课")
    print("[12:50~14:20]大学英语")
    print("[18:45~20:55]Python语言")
elif week in "四":
    print("今日课表")
    print("[09:45~12:00]毛概课")
    print("[14:30~16:55]网站运营与管理")
    print("[18:45~20:55]API、机器学习与人工智能")
elif week in "五":
    print("今日课表")
    print("[08:00~09:30]大学英语")
else:
    print("今日课表")
    print("今日无课")

if week in "Monday" and "0:00" <= now < "17:00":
    print("目前状态：今天没课，但是下午有用户界面设计，有时间可以去旁听哦")
elif week in "Monday" and "17:00" <= now < "21:00":
    print("目前状态：今天晚上有社团的上门不要忘记了哦")
elif week in "Monday" and "21:00" <= now < "23:59":
    print("目前状态：休息一下吧")
elif week in "Tuesday" and "0:00" <= now < "12:00":
    print("目前状态：今天上午没课，可以做自己想做的事情啦")
elif week in "Tuesday" and "12:00" <= now < "12:50":
    print("目前状态：准备上 Illustrato 软件应用课啦")
elif week in "Tuesday" and "12:50" <= now < "14:20":
    print("目前状态：Illustrato 软件应用课")
elif week in "Tuesday" and "14:20" <= now < "14:30":
    print("目前状态：准备上足球课啦")
elif week in "Tuesday" and "14:30" <= now < "15:55":
    print("目前状态：足球课")
elif week in "Tuesday" and "15:55" <= now < "18:45":
    print("目前状态：准备上设计美学课啦")
elif week in "Tuesday" and "18:45" <= now < "20:10":
    print("目前状态：设计美学课")
elif week in "Tuesday" and "20:10" <= now < "23:59":
    print("目前状态：休息一下吧")
elif week in "Wednesday" and "08:00" <= now < "09:30":
    print("目前状态：毛概实践课")
elif week in "Wednesday" and "09:30" <= now < "12:50":
    print("目前状态：准备上中午的大英课啦")
elif week in "Wednesday" and "12:50" <= now < "14:20":
    print("目前状态：大学英语课")
elif week in "Wednesday" and "14:20" <= now < "18:45":
    print("目前状态：准备上晚上的python课啦")
elif week in "Wednesday" and "18:45" <= now < "20:55":
    print("目前状态：python语言课")
elif week in "Wednesday" and "20:55" <= now < "23:59":
    print("目前状态：休息一下吧")
elif week in "Thursday" and "00:00" <= now < "09:45":
    print("目前状态：准备上毛概课啦")
elif week in "Thursday" and "09:45" <= now < "12:00":
    print("目前状态：毛概课")
elif week in "Thursday" and "12:00" <= now < "14:20":
    print("目前状态：准备上网站运营与管理课啦")
elif week in "Thursday" and "14:20" <= now < "16:50":
    print("目前状态：网站运营与管理课")
elif week in "Thursday" and "16:50" <= now < "18:45":
    print("目前状态：准备上API、机器学习与人工智能课啦")
elif week in "Thursday" and "18:45" <= now < "20:55":
    print("目前状态：API、机器学习与人工智能课")
elif week in "Thursday" and "20:55" <= now < "23:59":
    print("目前状态：休息一下吧")
elif week in "Friday" and "00:00" <= now < "08:00":
    print("目前状态：准备上大英课啦")
elif week in "Friday" and "08:00" <= now < "09:30":
    print("目前状态：大学英语课")
else:
    print("目前状态：现在没课哦，可以做自己想做的事情啦")


print("------------------------------------")

if judge_day in "是":
    if week_day in "Monday":
        print("今日课表")
        print("今日无课")
    elif week_day in "Tuesday":
        print("今日课表")
        print("[12:50~14:20]Illustrato软件应用")
        print("[14:30~15:55]体育—足球课")
        print("[18:45~20:55]设计美学")
    elif week_day in "Wednesday":
        print("今日课表")
        print("[08:00~09:30]毛概实践课")
        print("[12:50~14:20]大学英语")
        print("[18:45~20:55]Python语言")
    elif week_day in "Thursday":
        print("今日课表")
        print("[09:45~12:00]毛概课")
        print("[14:30~16:55]网站运营与管理")
        print("[18:45~20:55]API、机器学习与人工智能")
    elif week_day in "Friday":
        print("今日课表")
        print("[08:00~09:30]大学英语")
    else:
        print("今日课表")
        print("今日无课")
else:
    print("")

print("------------------------------------")
if judge_current in "是":
    print("当前时间：",time_now)
    if week in "Monday" and "0:00" < time_now < "17:00":
        print("目前状态：今天没课，但是下午有用户界面设计，有时间可以去旁听哦")
    elif week in "Monday" and "17:00" < time_now < "21:00":
        print("目前状态：今天晚上有社团的上门不要忘记了哦")
    elif week in "Monday" and "21:00" <= time_now < "23:59":
        print("目前状态：休息一下吧")
    elif week in "Tuesday" and "0:00" < time_now < "12:00":
        print("目前状态：今天上午没课，可以做自己想做的事情啦")
    elif week in "Tuesday" and "12:00" <= time_now < "12:50":
        print("目前状态：准备上Illustrato软件应用课啦")
    elif week in "Tuesday" and "12:50" <= time_now < "14:20":
        print("目前状态：Illustrato软件应用课")
    elif week in "Tuesday" and "14:20" <= time_now < "14:30":
        print("目前状态：准备上足球课啦")
    elif week in "Tuesday" and "14:30" <= time_now < "15:55":
        print("目前状态：足球课")
    elif week in "Tuesday" and "15:55" <= time_now < "18:45":
        print("目前状态：准备上设计美学课啦")
    elif week in "Tuesday" and "18:45" <= time_now < "20:10":
        print("目前状态：设计美学课")
    elif week in "Tuesday" and "20:10" <= time_now < "23:59":
        print("目前状态：休息一下吧")
    elif week in "Wednesday" and "08:00" <= time_now < "09:30":
        print("目前状态：毛概实践课")
    elif week in "Wednesday" and "09:30" <= time_now < "12:50":
        print("目前状态：准备上中午的大英课啦")
    elif week in "Wednesday" and "12:50" <= time_now < "14:20":
        print("目前状态：大学英语课")
    elif week in "Wednesday" and "14:20" <= time_now < "18:45":
        print("目前状态：准备上晚上的python课啦")
    elif week in "Wednesday" and "18:45" <= time_now < "20:55":
        print("目前状态：python语言课")
    elif week in "Wednesday" and "20:55" <= time_now < "23:59":
        print("目前状态：休息一下吧")
    elif week in "Thursday" and "00:00" <= time_now < "09:45":
        print("目前状态：准备上毛概课啦")
    elif week in "Thursday" and "09:45" <= time_now < "12:00":
        print("目前状态：毛概课")
    elif week in "Thursday" and "12:00" <= time_now < "14:20":
        print("目前状态：准备上网站运营与管理课啦")
    elif week in "Thursday" and "14:20" <= time_now < "16:50":
        print("目前状态：网站运营与管理课")
    elif week in "Thursday" and "16:50" <= time_now < "18:45":
        print("目前状态：准备上API、机器学习与人工智能课啦")
    elif week in "Thursday" and "18:45" <= time_now < "20:55":
        print("目前状态：API、机器学习与人工智能课")
    elif week in "Thursday" and "20:55" <= time_now < "23:59":
        print("目前状态：休息一下吧")
    elif week in "Friday" and "00:00" <= time_now < "08:00":
        print("目前状态：准备上大英课啦")
    elif week in "Friday" and "08:00" <= time_now < "09:30":
        print("目前状态：大学英语课")
    else:
        print("目前状态：现在没课哦，可以做自己想做的事情啦")
else:
    print("")

print("------------------------------------")

# 3. Python内置数据结构 列表 切片、方法练习

names = ["小明","小白","小红","小琪","小宝","小文","小可"]
print(names)

#查询相应顺序的内容
print(names[0])

# 1.增加 append 增加在列表末尾
names.append("小雪")
print(names)

# 2.增加 insert 增加到相应位置
names.insert(2,"小茹")
print(names)

# 3.删除 pop
names.pop() #如果什么都不填，自动删除最后一位
print(names)

names.pop(2)
print(names) #删除了指定位置的内容
print(names.pop(2))

# 4.指定名字删除 remove
names.remove("小可")
print(names)

# 5.修改替换
names[0] = "小璐"
print(names)

# 6.适合我不知道位置的修改方法 （index 查询该内容所在的顺序）
_name = "小白"
if _name in names:
    names[names.index(_name)]="小西"
else:
    print("%s不在本列表内")%(_name)
print(names)

# 7.查有没有、在不在（列表的切片）
_name = "小宝"
if _name in names:
    print(names.index(_name))#index 可以反馈该对象的位置
    names[0] = "小文" #改
    print(names)
else:
    print("%s不在我们的列表中"%(_name))

# 列表的切片
names = ["小明","小白","小红","小琪","小宝","小文","小可"]
print(names)
print(names[1],names[2])

#切片 仍然是一个列表 回顾range(1,3) 末位没取到
print(names[0:3])#留左不留右
print(names[:3])#如果从列表首位开始则可以不写

#从末位开始取
print(names[-3:-1])#留右不留左
print(names[-3:])#还是要从小到大的写
print(names[-1:])#留右不留左

#列表的开始 结束 步长
print(names[7:1:-1])#正数的留左不留右
print(names[-6:-1:1])#负数的留右不留左

#清空列表 clear
names.clear()
print(names)
#
#查重 看看某个对象出现了多少次
a = [1,2,3,4,3,2,1]
print(a.count(2))
#
# # # 思考题：
# # # names = [.....]
# # # 想找出重名的名字 ------> rename = [..]？
# # #
# # # 循环遍历每一个元素---->[]
# # # 如果遍历到某一个前面出现过，存到一个[]
# # # 计算重名个数？ '''
#
names = ["小晨","小白","小宝","小红","小琪","小宝","小猪","小文","小可","小欣","小明","小果","小猪"]
rename = []
a = []
from collections import Counter
result = Counter(names)
print(result)
for i in names:
  if names.count(i)>1:
      if i not in rename:
          rename.append(i)
          print(rename)

if rename == a:
    print("没有重复的名字出现")
# print(result)

# [列表训练营]
# 1. 输入一行字符，分别统计出其中英文字母、空格、数字和其它字符的个数。
# 2. 班上投票竞选，将选择票数最高的同学担任班长，请你设计一个投票系统，输入名字即可投票，最后统计大家的得票数，公开投票结果，并宣布谁担任班长。

# 字符串统计
str = input("请输入一串字符:")
result = {}
for i in str:
    result[i]=str.count(i)
print(result)
# letter = ["a","b","c","d","e","f","g","h","j","k","l","m","n","o","p","q","r","s","t","u","v","w","s","y","z"]


#投票系统
names = []
for i in range(10):
    print("----------------投票竞选系统--------------------")
    _names = input("输入你想投票的同学名字：")
    print(_names)
    names.append(_names)
    from collections import Counter
    result = Counter(names)
    print(result)
    print("------------------投票结束----------------------")
